﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Rison.DataAccess.Common
{
    public sealed class SqlField
    {
        private string _name = string.Empty;
        private object _value = null;
        private bool _isIdentity = false;//是否自增长主键
        private bool _isKey = false;//是否关键字
        private bool _needQuotes = true;//是否需要单引号

        public SqlField(string name, object value)
        {
            _name = name;
            _value = value;            
        }

        public SqlField(string name, object value, bool needQuotes)
        {
            _name = name;
            _value = value;
            _needQuotes = needQuotes;
        }

        public SqlField(string name, object value, bool isIdentity, bool needQuotes)
        {
            _name = name;
            _value = value;
            _isIdentity = isIdentity;
            _needQuotes = (_isIdentity) ? false : needQuotes;
        }

        public string Name
        {
            get { return _name; }
        }

        public object Value
        {
            get { return _value; }
            set { _value = value; }
        }

        public bool NeedQuotes
        {
            get { return _needQuotes; }
            set { _needQuotes = value; }
        }

        public bool IsIdentity
        {
            get { return _isIdentity; }
            set { _isIdentity = value; }
        }

        public bool IsKey
        {
            get { return _isKey; }
            set { _isKey = value; }
        }
    }
}
